<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>短网址</title>
		<!-- 更多内容在source.jsp -->
		<link rel="short icon" href="images/icon.jpg" />
		<script charset="utf-8" src="kindeditor/kindeditor.js"></script>
		<script charset="utf-8" src="kindeditor/lang/zh_CN.js"></script>
		<script type="text/javascript" src="js/jquery.js"></script>
		<script type="text/javascript">
	$(document).ready(function() {

		$(".getcode").click(function() {

			var url = editor.html();
			var passW = $("#password").val();
			var burnT=$("#burnTime").val();
			var statusValue=$("input[name='statusRadio']:checked").val();			
			
			var outTime=$("#outDay").val()+","+$("#outHour").val()+","+$("#outMinute").val()+","+$("#outSecond").val();
			if (url == "" || url == null) {
				alert("请输入内容");
			} else {			    			
				$(".getcode").attr('disabled', true);
				$.post("short.do", {
					check : "bean",
					url : url,
					password : passW,
					outOfTime:outTime,
					checkStatus:statusValue,
					burnTime:burnT
				}, function(json) {
					var href = window.location.href;
					if (href.indexOf(".jsp") > 0) {
						href = href.substring(0, href.indexOf("index.jsp"));
					}

					$(".acde").html(href + json);
					$(".acde").attr("href", href + json);
					$(".getcode").attr('disabled', false);
				});
			}

		});
	})

	var editor;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[name="url"]', {
			resizeType : 2,
			cssPath : 'kindeditor/plugins/code/prettify.css',
			uploadJson : 'kindeditor/jsp/upload_json.jsp',
			fileManagerJson : 'kindeditor/jsp/file_manager_json.jsp',
			allowFileManager : true,
			items : [ 'code', '|', 'preview', 'print', 'template', 'cut',
					'copy', 'paste', 'plainpaste', 'wordpaste', '|',
					'justifyleft', 'justifycenter', 'justifyright',
					'justifyfull', 'insertorderedlist', 'insertunorderedlist',
					'indent', 'outdent', 'subscript', 'superscript',
					'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen',
					'insertfile', '/', 'formatblock', 'fontname', 'fontsize',
					'|', 'forecolor', 'hilitecolor', 'bold', 'italic',
					'underline', 'strikethrough', 'lineheight', 'removeformat',
					'|', 'image', 'multiimage', 'flash', 'media', 'table',
					'hr', 'emoticons', 'baidumap', 'pagebreak', 'anchor',
					'link', 'unlink', ]
		});
	});
</script>



	</head>


	<body style="background-color: scrollbar">

		<center>
			<table>
				<tr>
					<td>
						<textarea rows="10" cols="100" style="height: 300px;" name="url" id="url" class="url" title="输入一个网址,我来帮你把它变短"></textarea>
					</td>
					<td>
						<input type="button" value="短点" title="点击变短" style="height: 20x;" class="getcode" />
					</td>
				</tr>
				<tr></tr>

				<tr></tr>
				<tr></tr>
				<tr>
					<td>
						&nbsp;&nbsp;
						<a id="ta" class="acde" target="_blank"></a>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<br />
						加密密码:
						<input type="password" id="password" name="password" title="为生成的短网址加密" />
					</td>
				</tr>
				<tr>
					<td colspan="2">
					    <input  name="statusRadio"  type="radio" value="0" checked="checked"/>
						失效时间:
						     <input id="outDay" type="number" min="0" max="30" step="1" value="0">天 
							 <input id="outHour" type="number" min="0" max="24" step="1" value="0">小时 
							 <input id="outMinute" type="number" min="0" max="60" step="1"value="0">分钟 
							 <input id="outSecond" type="number" min="0" max="60"step="1" value="0">秒 
					</td>
				</tr>
				
				<tr>
					<td colspan="2">
					    <input  name="statusRadio" type="radio" value="1"/>
						阅后即焚:						    
							 <input id="burnTime" type="number" min="0" max="60"step="1" value="5" maxlength="3" />秒 
					</td>
				</tr>
				
			</table>
		</center>
		<br />
		<br />
		<br />
		<br />
		<br />
		<p align="center">
			简要说明
			<br />
			<br />
			1、把一长串网址放到上面的大筐筐里，然后点击按钮，生成一个网址，点击新生成的网址，一样能打开原来的页面
			<br />
			<br />
			2、把一段文本或者代码，贴到大筐筐里，然后生成一个网址，然后分享给朋友，主要用于共享临时代码<br/><br/>
			3、可以为网址加密<br/><br/>
			4、可以设置网页失效时间<br/><br/>
			5、可以搞成阅后即焚哦<br/><br/>
			6、可以进行评论了<br/><br/>
		</p>






		<script type="text/javascript">
	var cnzz_protocol = (("https:" == document.location.protocol) ? " https://": " http://");
	document.write(unescape("%3Cspan id='cnzz_stat_icon_1256422574'%3E%3C/span%3E%3Cscript src='"+ cnzz_protocol+ "s11.cnzz.com/z_stat.php%3Fid%3D1256422574%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));
</script>
	</body>
</html>
